package com.gitee.chenyaohua;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@Data
@ApiModel(description = "${tableComment}")
public class ${tableAlias} {

<#list columns as cloumn>
    <#if cloumn.jdbcType !='enum' && cloumn.jdbcType !='json' && cloumn.jdbcType !='set'>
<#if cloumn.isNull=='NO'>
    <#switch cloumn.jdbcType>
        <#case "varchar">
        <#case "longtext">
        <#case "text">
        <#case "mediumtext">
        <#case "char">
        @NotEmpty(message = "${cloumn.columnComment}不能为空")
            <#if cloumn.maxLength??>
        @Length(max = ${cloumn.maxLength})
            </#if>
            <#break >
        <#case "int">
        <#case "bigint">
        <#case "time">
        <#case "year">
        <#case "datetime">
        <#case "timestamp">
        <#case "date">
        <#case "binary">
        <#case "varbinary">
        <#case "tinyint">
        <#case "blob">
        <#case "decimal">
        <#case "float">
        @NotNull(message = "${cloumn.columnComment}")
        <#break >
    </#switch>
</#if>
<#if 'NO'==cloumn.isNull>
        @ApiModelProperty(name = "${cloumn.attrName}",required = true,notes = "${cloumn.columnComment}")
<#else >
        @ApiModelProperty(name = "${cloumn.attrName}",required = false,notes = "${cloumn.columnComment}")
</#if>
        private ${cloumn.javaType} ${cloumn.attrName};
    </#if>

</#list>

}